package com.buer.storage.service.impl;

import com.buer.storage.dao.AreaDao;
import com.buer.storage.dto.AreaDto;
import com.buer.storage.dto.DepartmentDto;
import com.buer.storage.entity.Area;
import com.buer.storage.service.AreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AreaServiceImpl implements AreaService {
    @Autowired
    private AreaDao areaDao;

    @Override
    public int add(AreaDto areaDto) {
        return areaDao.add(areaDto);
    }

    @Override
    public int delete(int areaId) {
        return areaDao.delete(areaId);
    }

    @Override
    public int update(Area area) {
        return areaDao.update(area);
    }

    @Override
    public Area selectById(int areaId) {
        return areaDao.selectById(areaId);
    }

    @Override
    public List<DepartmentDto> findDepartment(int areaId) {
        List<DepartmentDto> department = areaDao.findDepartment(areaId);
        return department;
    }

    @Override
    public List<Area> getAll() {
        return areaDao.getAll();
    }

    @Override
    public List<String> getDepartmentByAreaId(int areaId) {
        return areaDao.getDepartmentByAreaId(areaId);
    }

    @Override
    public Area getAreaByName(String areaName) {
        return areaDao.getAreaByName(areaName);
    }


}
